//
//  BQMissionHeaderView.m
//  Adorable_Things
//
//  Created by ybq on 16/1/14.
//  Copyright © 2016年 Banana Inc. All rights reserved.
//

#import "BQMissionHeaderView.h"

@implementation BQMissionHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _mainImageView = [[UIImageView alloc] initWithFrame:frame];
        _mainImageView.image = [UIImage imageNamed:@"missionHeaderImage"];
        [self addSubview:_mainImageView];
        
        _avatarImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 25, 25)];
        _avatarImageView.layer.masksToBounds = YES;
        _avatarImageView.layer.cornerRadius = 12.5;
        _avatarImageView.image = [UIImage imageNamed:@"avatar-no"];
        [self addSubview:_avatarImageView];
        
        _checkinCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(kWidth - kWidth / 5.35, kWidth / 29, 40, 20)];
        _checkinCountLabel.textColor = [UIColor whiteColor];
        _checkinCountLabel.textAlignment = NSTextAlignmentCenter;
        _checkinCountLabel.font = [UIFont boldSystemFontOfSize:18];
        _checkinCountLabel.text = @"0";
        [self addSubview:_checkinCountLabel];
        
        _surplusCountLabel = [[UILabel alloc] initWithFrame:CGRectMake((kWidth - 50) / 2, frame.size.height / 2 - 3, 50, 28)];
        _surplusCountLabel.textColor = [UIColor whiteColor];
        _surplusCountLabel.font = [UIFont boldSystemFontOfSize:38];
        _surplusCountLabel.text = @"0";
        _surplusCountLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_surplusCountLabel];
        
        _checkinButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _checkinButton.frame = CGRectMake(kWidth / 2 - 10, frame.size.height - kWidth / 15 - 15, 35, 15);
        _checkinButton.titleLabel.font = [UIFont systemFontOfSize:16];
        [_checkinButton setTitle:@"签到" forState:(UIControlStateNormal)];
        [_checkinButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
        [self addSubview:_checkinButton];
        
    }
    return self;
}

@end
